package com.restaurant.contract;

import org.fisco.bcos.sdk.v3.client.Client;
import org.fisco.bcos.sdk.v3.codec.datatypes.*;
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.Uint256;
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.tuples.generated.Tuple10;
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.tuples.generated.Tuple9;
import org.fisco.bcos.sdk.v3.contract.Contract;
import org.fisco.bcos.sdk.v3.crypto.CryptoSuite;
import org.fisco.bcos.sdk.v3.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.v3.model.CryptoType;
import org.fisco.bcos.sdk.v3.model.TransactionReceipt;
import org.fisco.bcos.sdk.v3.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.v3.transaction.model.exception.ContractException;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@SuppressWarnings("unchecked")
public class ProductRecord extends Contract {
    public static final String[] BINARY_ARRAY = {"608060405234801561001057600080fd5b5061111e806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806334461067146100515780637b85969714610083578063c2a4250b14610098578063ecfe570a146100af575b600080fd5b61006461005f366004610c54565b6100cf565b60405161007a9a99989796959493929190610cba565b60405180910390f35b610096610091366004610e0e565b6104d6565b005b6100a160015481565b60405190815260200161007a565b6100c26100bd366004610c54565b61066a565b60405161007a9190610f3d565b6000602081905290815260409020805460018201546002830154600384018054939492939192916100ff9061106e565b80601f016020809104026020016040519081016040528092919081815260200182805461012b9061106e565b80156101785780601f1061014d57610100808354040283529160200191610178565b820191906000526020600020905b81548152906001019060200180831161015b57829003601f168201915b50505050509080600401805461018d9061106e565b80601f01602080910402602001604051908101604052809291908181526020018280546101b99061106e565b80156102065780601f106101db57610100808354040283529160200191610206565b820191906000526020600020905b8154815290600101906020018083116101e957829003601f168201915b50505050509080600501805461021b9061106e565b80601f01602080910402602001604051908101604052809291908181526020018280546102479061106e565b80156102945780601f1061026957610100808354040283529160200191610294565b820191906000526020600020905b81548152906001019060200180831161027757829003601f168201915b5050505050908060060180546102a99061106e565b80601f01602080910402602001604051908101604052809291908181526020018280546102d59061106e565b80156103225780601f106102f757610100808354040283529160200191610322565b820191906000526020600020905b81548152906001019060200180831161030557829003601f168201915b5050505050908060070180546103379061106e565b80601f01602080910402602001604051908101604052809291908181526020018280546103639061106e565b80156103b05780601f10610385576101008083540402835291602001916103b0565b820191906000526020600020905b81548152906001019060200180831161039357829003601f168201915b5050505050908060080180546103c59061106e565b80601f01602080910402602001604051908101604052809291908181526020018280546103f19061106e565b801561043e5780601f106104135761010080835404028352916020019161043e565b820191906000526020600020905b81548152906001019060200180831161042157829003601f168201915b5050505050908060090180546104539061106e565b80601f016020809104026020016040519081016040528092919081815260200182805461047f9061106e565b80156104cc5780601f106104a1576101008083540402835291602001916104cc565b820191906000526020600020905b8154815290600101906020018083116104af57829003601f168201915b505050505090508a565b600180549060006104e6836110a9565b919050555060405180610140016040528060015481526020018a81526020018981526020018881526020018781526020018681526020018581526020018481526020018381526020018281525060008060015481526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003019080519060200190610581929190610bbb565b506080820151805161059d916004840191602090910190610bbb565b5060a082015180516105b9916005840191602090910190610bbb565b5060c082015180516105d5916006840191602090910190610bbb565b5060e082015180516105f1916007840191602090910190610bbb565b50610100820151805161060e916008840191602090910190610bbb565b50610120820151805161062b916009840191602090910190610bbb565b50506001546040518a92508b91907facae88f8c5ced2bba1920b1be99fa426c3fff4cd1d557ce6665f281b096c3e2290600090a4505050505050505050565b6060600060015467ffffffffffffffff81111561068957610689610d6b565b60405190808252806020026020018201604052801561071057816020015b6106fd604051806101400160405280600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081525090565b8152602001906001900390816106a75790505b509050600060015b6001548111610bb257600081815260208190526040902060010154851415610ba057600080828152602001908152602001600020604051806101400160405290816000820154815260200160018201548152602001600282015481526020016003820180546107869061106e565b80601f01602080910402602001604051908101604052809291908181526020018280546107b29061106e565b80156107ff5780601f106107d4576101008083540402835291602001916107ff565b820191906000526020600020905b8154815290600101906020018083116107e257829003601f168201915b505050505081526020016004820180546108189061106e565b80601f01602080910402602001604051908101604052809291908181526020018280546108449061106e565b80156108915780601f1061086657610100808354040283529160200191610891565b820191906000526020600020905b81548152906001019060200180831161087457829003601f168201915b505050505081526020016005820180546108aa9061106e565b80601f01602080910402602001604051908101604052809291908181526020018280546108d69061106e565b80156109235780601f106108f857610100808354040283529160200191610923565b820191906000526020600020905b81548152906001019060200180831161090657829003601f168201915b5050505050815260200160068201805461093c9061106e565b80601f01602080910402602001604051908101604052809291908181526020018280546109689061106e565b80156109b55780601f1061098a576101008083540402835291602001916109b5565b820191906000526020600020905b81548152906001019060200180831161099857829003601f168201915b505050505081526020016007820180546109ce9061106e565b80601f01602080910402602001604051908101604052809291908181526020018280546109fa9061106e565b8015610a475780601f10610a1c57610100808354040283529160200191610a47565b820191906000526020600020905b815481529060010190602001808311610a2a57829003601f168201915b50505050508152602001600882018054610a609061106e565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8c9061106e565b8015610ad95780601f10610aae57610100808354040283529160200191610ad9565b820191906000526020600020905b815481529060010190602001808311610abc57829003601f168201915b50505050508152602001600982018054610af29061106e565b80601f0160208091040260200160405190810160405280929190818152602001828054610b1e9061106e565b8015610b6b5780601f10610b4057610100808354040283529160200191610b6b565b820191906000526020600020905b815481529060010190602001808311610b4e57829003601f168201915b505050505081525050838381518110610b8657610b866110d2565b60200260200101819052508180610b9c906110a9565b9250505b80610baa816110a9565b915050610718565b50815292915050565b828054610bc79061106e565b90600052602060002090601f016020900481019282610be95760008555610c2f565b82601f10610c0257805160ff1916838001178555610c2f565b82800160010185558215610c2f579182015b82811115610c2f578251825591602001919060010190610c14565b50610c3b929150610c3f565b5090565b5b80821115610c3b5760008155600101610c40565b600060208284031215610c6657600080fd5b5035919050565b6000815180845260005b81811015610c9357602081850181015186830182015201610c77565b81811115610ca5576000602083870101525b50601f01601f19169290920160200192915050565b60006101408c83528b60208401528a6040840152806060840152610ce08184018b610c6d565b90508281036080840152610cf4818a610c6d565b905082810360a0840152610d088189610c6d565b905082810360c0840152610d1c8188610c6d565b905082810360e0840152610d308187610c6d565b9050828103610100840152610d458186610c6d565b9050828103610120840152610d5a8185610c6d565b9d9c50505050505050505050505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610d9257600080fd5b813567ffffffffffffffff80821115610dad57610dad610d6b565b604051601f8301601f19908116603f01168101908282118183101715610dd557610dd5610d6b565b81604052838152866020858801011115610dee57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060008060006101208a8c031215610e2d57600080fd5b8935985060208a0135975060408a013567ffffffffffffffff80821115610e5357600080fd5b610e5f8d838e01610d81565b985060608c0135915080821115610e7557600080fd5b610e818d838e01610d81565b975060808c0135915080821115610e9757600080fd5b610ea38d838e01610d81565b965060a08c0135915080821115610eb957600080fd5b610ec58d838e01610d81565b955060c08c0135915080821115610edb57600080fd5b610ee78d838e01610d81565b945060e08c0135915080821115610efd57600080fd5b610f098d838e01610d81565b93506101008c0135915080821115610f2057600080fd5b50610f2d8c828d01610d81565b9150509295985092959850929598565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561106057603f19898403018552815161014081518552888201518986015287820151888601526060808301518282880152610fa583880182610c6d565b9250505060808083015186830382880152610fc08382610c6d565b9250505060a08083015186830382880152610fdb8382610c6d565b92505050","60c08083015186830382880152610ff68382610c6d565b9250505060e080830151868303828801526110118382610c6d565b92505050610100808301518683038288015261102d8382610c6d565b92505050610120808301519250858203818701525061104c8183610c6d565b968901969450505090860190600101610f64565b509098975050505050505050565b600181811c9082168061108257607f821691505b602082108114156110a357634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156110cb57634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fdfea264697066735822122050b9acdbfcb57d5e79d71700d8ebec21c1913327b55bbcf20f56c003b0214aa664736f6c634300080b0033"};

    public static final String BINARY = org.fisco.bcos.sdk.v3.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {"608060405234801561001057600080fd5b5061111a806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063681ebc9f14610051578063994c65df1461006d578063a535c56214610082578063c860f85e146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61008061007b366004610cf3565b6100cb565b005b610095610090366004610e22565b61025f565b6040516100649190610e88565b6100b56100b0366004610e22565b6107b0565b6040516100649a99989796959493929190610fb9565b600180549060006100db8361106a565b919050555060405180610140016040528060015481526020018a81526020018981526020018881526020018781526020018681526020018581526020018481526020018381526020018281525060008060015481526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003019080519060200190610176929190610bb7565b5060808201518051610192916004840191602090910190610bb7565b5060a082015180516101ae916005840191602090910190610bb7565b5060c082015180516101ca916006840191602090910190610bb7565b5060e082015180516101e6916007840191602090910190610bb7565b506101008201518051610203916008840191602090910190610bb7565b506101208201518051610220916009840191602090910190610bb7565b50506001546040518a92508b91907f8ab2a636d95896cdfa3b100b15c58fa15a1f34a692c5a5875ca3a9d836e0e9e590600090a4505050505050505050565b6060600060015467ffffffffffffffff81111561027e5761027e610c50565b60405190808252806020026020018201604052801561030557816020015b6102f2604051806101400160405280600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081525090565b81526020019060019003908161029c5790505b509050600060015b60015481116107a757600081815260208190526040902060010154851415610795576000808281526020019081526020016000206040518061014001604052908160008201548152602001600182015481526020016002820154815260200160038201805461037b90611093565b80601f01602080910402602001604051908101604052809291908181526020018280546103a790611093565b80156103f45780601f106103c9576101008083540402835291602001916103f4565b820191906000526020600020905b8154815290600101906020018083116103d757829003601f168201915b5050505050815260200160048201805461040d90611093565b80601f016020809104026020016040519081016040528092919081815260200182805461043990611093565b80156104865780601f1061045b57610100808354040283529160200191610486565b820191906000526020600020905b81548152906001019060200180831161046957829003601f168201915b5050505050815260200160058201805461049f90611093565b80601f01602080910402602001604051908101604052809291908181526020018280546104cb90611093565b80156105185780601f106104ed57610100808354040283529160200191610518565b820191906000526020600020905b8154815290600101906020018083116104fb57829003601f168201915b5050505050815260200160068201805461053190611093565b80601f016020809104026020016040519081016040528092919081815260200182805461055d90611093565b80156105aa5780601f1061057f576101008083540402835291602001916105aa565b820191906000526020600020905b81548152906001019060200180831161058d57829003601f168201915b505050505081526020016007820180546105c390611093565b80601f01602080910402602001604051908101604052809291908181526020018280546105ef90611093565b801561063c5780601f106106115761010080835404028352916020019161063c565b820191906000526020600020905b81548152906001019060200180831161061f57829003601f168201915b5050505050815260200160088201805461065590611093565b80601f016020809104026020016040519081016040528092919081815260200182805461068190611093565b80156106ce5780601f106106a3576101008083540402835291602001916106ce565b820191906000526020600020905b8154815290600101906020018083116106b157829003601f168201915b505050505081526020016009820180546106e790611093565b80601f016020809104026020016040519081016040528092919081815260200182805461071390611093565b80156107605780601f1061073557610100808354040283529160200191610760565b820191906000526020600020905b81548152906001019060200180831161074357829003601f168201915b50505050508152505083838151811061077b5761077b6110ce565b602002602001018190525081806107919061106a565b9250505b8061079f8161106a565b91505061030d565b50815292915050565b6000602081905290815260409020805460018201546002830154600384018054939492939192916107e090611093565b80601f016020809104026020016040519081016040528092919081815260200182805461080c90611093565b80156108595780601f1061082e57610100808354040283529160200191610859565b820191906000526020600020905b81548152906001019060200180831161083c57829003601f168201915b50505050509080600401805461086e90611093565b80601f016020809104026020016040519081016040528092919081815260200182805461089a90611093565b80156108e75780601f106108bc576101008083540402835291602001916108e7565b820191906000526020600020905b8154815290600101906020018083116108ca57829003601f168201915b5050505050908060050180546108fc90611093565b80601f016020809104026020016040519081016040528092919081815260200182805461092890611093565b80156109755780601f1061094a57610100808354040283529160200191610975565b820191906000526020600020905b81548152906001019060200180831161095857829003601f168201915b50505050509080600601805461098a90611093565b80601f01602080910402602001604051908101604052809291908181526020018280546109b690611093565b8015610a035780601f106109d857610100808354040283529160200191610a03565b820191906000526020600020905b8154815290600101906020018083116109e657829003601f168201915b505050505090806007018054610a1890611093565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4490611093565b8015610a915780601f10610a6657610100808354040283529160200191610a91565b820191906000526020600020905b815481529060010190602001808311610a7457829003601f168201915b505050505090806008018054610aa690611093565b80601f0160208091040260200160405190810160405280929190818152602001828054610ad290611093565b8015610b1f5780601f10610af457610100808354040283529160200191610b1f565b820191906000526020600020905b815481529060010190602001808311610b0257829003601f168201915b505050505090806009018054610b3490611093565b80601f0160208091040260200160405190810160405280929190818152602001828054610b6090611093565b8015610bad5780601f10610b8257610100808354040283529160200191610bad565b820191906000526020600020905b815481529060010190602001808311610b9057829003601f168201915b505050505090508a565b828054610bc390611093565b90600052602060002090601f016020900481019282610be55760008555610c2b565b82601f10610bfe57805160ff1916838001178555610c2b565b82800160010185558215610c2b579182015b82811115610c2b578251825591602001919060010190610c10565b50610c37929150610c3b565b5090565b5b80821115610c375760008155600101610c3c565b63b95aa35560e01b600052604160045260246000fd5b600082601f830112610c7757600080fd5b813567ffffffffffffffff80821115610c9257610c92610c50565b604051601f8301601f19908116603f01168101908282118183101715610cba57610cba610c50565b81604052838152866020858801011115610cd357600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060008060006101208a8c031215610d1257600080fd5b8935985060208a0135975060408a013567ffffffffffffffff80821115610d3857600080fd5b610d448d838e01610c66565b985060608c0135915080821115610d5a57600080fd5b610d668d838e01610c66565b975060808c0135915080821115610d7c57600080fd5b610d888d838e01610c66565b965060a08c0135915080821115610d9e57600080fd5b610daa8d838e01610c66565b955060c08c0135915080821115610dc057600080fd5b610dcc8d838e01610c66565b945060e08c0135915080821115610de257600080fd5b610dee8d838e01610c66565b93506101008c0135915080821115610e0557600080fd5b50610e128c828d01610c66565b9150509295985092959850929598565b600060208284031215610e3457600080fd5b5035919050565b6000815180845260005b81811015610e6157602081850181015186830182015201610e45565b81811115610e73576000602083870101525b50601f01601f19169290920160200192915050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015610fab57603f19898403018552815161014081518552888201518986015287820151888601526060808301518282880152610ef083880182610e3b565b9250505060808083015186830382880152610f0b8382610e3b565b9250505060a08083015186830382880152610f268382610e3b565b9250505060c08083015186830382880152610f418382610e3b565b9250505060e08083015186830382880152610f5c8382610e3b565b925050506101008083015186830382880152610f788382610e3b565b925050506101208083015192508582038187015250610f978183610e3b565b968901969450505090860190600101610eaf565b509098975050505050505050565b60006101408c83528b60208401528a6040840152806060840152610fdf8184018b610e3b565b","90508281036080840152610ff3818a610e3b565b905082810360a08401526110078189610e3b565b905082810360c084015261101b8188610e3b565b905082810360e084015261102f8187610e3b565b90508281036101008401526110448186610e3b565b90508281036101208401526110598185610e3b565b9d9c50505050505050505050505050565b600060001982141561108c5763b95aa35560e01b600052601160045260246000fd5b5060010190565b600181811c908216806110a757607f821691505b602082108114156110c85763b95aa35560e01b600052602260045260246000fd5b50919050565b63b95aa35560e01b600052603260045260246000fdfea264697066735822122000440aab803afddd9a359f0ebf9cec814adea0bb1d6483403bb7c9caf5fab78564736f6c634300080b0033"};

    public static final String SM_BINARY = org.fisco.bcos.sdk.v3.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {"[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"productId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"userId\",\"type\":\"uint256\"}],\"name\":\"RecordAdded\",\"type\":\"event\"},{\"conflictFields\":[{\"kind\":0},{\"kind\":4,\"value\":[1]}],\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"productId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"temperature\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"illumination\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"remark\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"pictureIpfsHash\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"water\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"growthSituation\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"recordTime\",\"type\":\"string\"}],\"name\":\"addRecord\",\"outputs\":[],\"selector\":[2072352407,2571920863],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"conflictFields\":[{\"kind\":0},{\"kind\":4,\"value\":[1]}],\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"productId\",\"type\":\"uint256\"}],\"name\":\"getRecordsByProductId\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"productId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"temperature\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"illumination\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"remark\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"pictureIpfsHash\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"water\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"growthSituation\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"recordTime\",\"type\":\"string\"}],\"internalType\":\"struct ProductRecord.Record[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"selector\":[3976091402,2771764578],\"stateMutability\":\"view\",\"type\":\"function\"},{\"conflictFields\":[{\"kind\":4,\"value\":[1]}],\"inputs\":[],\"name\":\"lastBlockId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"selector\":[3265537291,1746844831],\"stateMutability\":\"view\",\"type\":\"function\"},{\"conflictFields\":[{\"kind\":3,\"slot\":0,\"value\":[0]}],\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"records\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"productId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"userId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"temperature\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"illumination\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"remark\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"pictureIpfsHash\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"water\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"growthSituation\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"recordTime\",\"type\":\"string\"}],\"selector\":[877006951,3361798238],\"stateMutability\":\"view\",\"type\":\"function\"}]"};

    public static final String ABI = org.fisco.bcos.sdk.v3.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_ADDRECORD = "addRecord";

    public static final String FUNC_GETRECORDSBYPRODUCTID = "getRecordsByProductId";

    public static final String FUNC_LASTBLOCKID = "lastBlockId";

    public static final String FUNC_RECORDS = "records";

    public static final Event RECORDADDED_EVENT = new Event("RecordAdded",
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>(true) {}, new TypeReference<Uint256>(true) {}, new TypeReference<Uint256>(true) {}));
    ;

    protected ProductRecord(String contractAddress, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public static String getABI() {
        return ABI;
    }

    public List<RecordAddedEventResponse> getRecordAddedEvents(
            TransactionReceipt transactionReceipt) {
        List<EventValuesWithLog> valueList = extractEventParametersWithLog(RECORDADDED_EVENT, transactionReceipt);
        ArrayList<RecordAddedEventResponse> responses = new ArrayList<RecordAddedEventResponse>(valueList.size());
        for (EventValuesWithLog eventValues : valueList) {
            RecordAddedEventResponse typedResponse = new RecordAddedEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.blockId = (BigInteger) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.productId = (BigInteger) eventValues.getIndexedValues().get(1).getValue();
            typedResponse.userId = (BigInteger) eventValues.getIndexedValues().get(2).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public TransactionReceipt addRecord(BigInteger productId, BigInteger userId, String temperature,
                                        String illumination, String remark, String pictureIpfsHash, String water,
                                        String growthSituation, String recordTime) {
        final Function function = new Function(
                FUNC_ADDRECORD,
                Arrays.<Type>asList(new Uint256(productId),
                        new Uint256(userId),
                        new Utf8String(temperature),
                        new Utf8String(illumination),
                        new Utf8String(remark),
                        new Utf8String(pictureIpfsHash),
                        new Utf8String(water),
                        new Utf8String(growthSituation),
                        new Utf8String(recordTime)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return executeTransaction(function);
    }

    public String getSignedTransactionForAddRecord(BigInteger productId, BigInteger userId,
                                                   String temperature, String illumination, String remark, String pictureIpfsHash,
                                                   String water, String growthSituation, String recordTime) {
        final Function function = new Function(
                FUNC_ADDRECORD,
                Arrays.<Type>asList(new Uint256(productId),
                        new Uint256(userId),
                        new Utf8String(temperature),
                        new Utf8String(illumination),
                        new Utf8String(remark),
                        new Utf8String(pictureIpfsHash),
                        new Utf8String(water),
                        new Utf8String(growthSituation),
                        new Utf8String(recordTime)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return createSignedTransaction(function);
    }

    public String addRecord(BigInteger productId, BigInteger userId, String temperature,
                            String illumination, String remark, String pictureIpfsHash, String water,
                            String growthSituation, String recordTime, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_ADDRECORD,
                Arrays.<Type>asList(new Uint256(productId),
                        new Uint256(userId),
                        new Utf8String(temperature),
                        new Utf8String(illumination),
                        new Utf8String(remark),
                        new Utf8String(pictureIpfsHash),
                        new Utf8String(water),
                        new Utf8String(growthSituation),
                        new Utf8String(recordTime)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return asyncExecuteTransaction(function, callback);
    }

    public Tuple9<BigInteger, BigInteger, String, String, String, String, String, String, String> getAddRecordInput(
            TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_ADDRECORD,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple9<BigInteger, BigInteger, String, String, String, String, String, String, String>(

                (BigInteger) results.get(0).getValue(),
                (BigInteger) results.get(1).getValue(),
                (String) results.get(2).getValue(),
                (String) results.get(3).getValue(),
                (String) results.get(4).getValue(),
                (String) results.get(5).getValue(),
                (String) results.get(6).getValue(),
                (String) results.get(7).getValue(),
                (String) results.get(8).getValue()
        );
    }

    public List<Record> getRecordsByProductId(BigInteger productId) throws ContractException {
        final Function function = new Function(FUNC_GETRECORDSBYPRODUCTID,
                Arrays.<Type>asList(new Uint256(productId)),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Record>>() {}));
        return executeCallWithSingleValueReturn(function, List.class);
    }

    public BigInteger lastBlockId() throws ContractException {
        final Function function = new Function(FUNC_LASTBLOCKID,
                Arrays.<Type>asList(),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public Tuple10<BigInteger, BigInteger, BigInteger, String, String, String, String, String, String, String> records(
            BigInteger param0) throws ContractException {
        final Function function = new Function(FUNC_RECORDS,
                Arrays.<Type>asList(new Uint256(param0)),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple10<BigInteger, BigInteger, BigInteger, String, String, String, String, String, String, String>(
                (BigInteger) results.get(0).getValue(),
                (BigInteger) results.get(1).getValue(),
                (BigInteger) results.get(2).getValue(),
                (String) results.get(3).getValue(),
                (String) results.get(4).getValue(),
                (String) results.get(5).getValue(),
                (String) results.get(6).getValue(),
                (String) results.get(7).getValue(),
                (String) results.get(8).getValue(),
                (String) results.get(9).getValue());
    }

    public static ProductRecord load(String contractAddress, Client client,
                                     CryptoKeyPair credential) {
        return new ProductRecord(contractAddress, client, credential);
    }

    public static ProductRecord deploy(Client client, CryptoKeyPair credential) throws
            ContractException {
        return deploy(ProductRecord.class, client, credential, getBinary(client.getCryptoSuite()), getABI(), null, null);
    }

    public static class Record extends DynamicStruct {
        public BigInteger blockId;

        public BigInteger productId;

        public BigInteger userId;

        public String temperature;

        public String illumination;

        public String remark;

        public String pictureIpfsHash;

        public String water;

        public String growthSituation;

        public String recordTime;


        public Record(BigInteger blockId, BigInteger productId, BigInteger userId,
                      String temperature, String illumination, String remark, String pictureIpfsHash,
                      String water, String growthSituation, String recordTime) {
            super(new Uint256(blockId),new Uint256(productId),new Uint256(userId),new Utf8String(temperature),new Utf8String(illumination),new Utf8String(remark),new Utf8String(pictureIpfsHash),new Utf8String(water),new Utf8String(growthSituation),new Utf8String(recordTime));
            this.blockId = blockId;
            this.productId = productId;
            this.userId = userId;
            this.temperature = temperature;
            this.illumination = illumination;
            this.remark = remark;
            this.pictureIpfsHash = pictureIpfsHash;
            this.water = water;
            this.growthSituation = growthSituation;
            this.recordTime = recordTime;
        }
        public Record(Uint256 blockId, Uint256 productId, Uint256 userId, Utf8String temperature,
                      Utf8String illumination, Utf8String remark, Utf8String pictureIpfsHash,
                      Utf8String water, Utf8String growthSituation, Utf8String recordTime) {
            super(blockId,productId,userId,temperature,illumination,remark,pictureIpfsHash,water,growthSituation,recordTime);
            this.blockId = blockId.getValue();
            this.productId = productId.getValue();
            this.userId = userId.getValue();
            this.temperature = temperature.getValue();
            this.illumination = illumination.getValue();
            this.remark = remark.getValue();
            this.pictureIpfsHash = pictureIpfsHash.getValue();
            this.water = water.getValue();
            this.growthSituation = growthSituation.getValue();
            this.recordTime = recordTime.getValue();
        }

        public BigInteger getBlockId() {
            return blockId;
        }

        public void setBlockId(BigInteger blockId) {
            this.blockId = blockId;
        }

        public BigInteger getProductId() {
            return productId;
        }

        public void setProductId(BigInteger productId) {
            this.productId = productId;
        }

        public BigInteger getUserId() {
            return userId;
        }

        public void setUserId(BigInteger userId) {
            this.userId = userId;
        }

        public String getTemperature() {
            return temperature;
        }

        public void setTemperature(String temperature) {
            this.temperature = temperature;
        }

        public String getIllumination() {
            return illumination;
        }

        public void setIllumination(String illumination) {
            this.illumination = illumination;
        }

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        public String getPictureIpfsHash() {
            return pictureIpfsHash;
        }

        public void setPictureIpfsHash(String pictureIpfsHash) {
            this.pictureIpfsHash = pictureIpfsHash;
        }

        public String getWater() {
            return water;
        }

        public void setWater(String water) {
            this.water = water;
        }

        public String getGrowthSituation() {
            return growthSituation;
        }

        public void setGrowthSituation(String growthSituation) {
            this.growthSituation = growthSituation;
        }

        public String getRecordTime() {
            return recordTime;
        }

        public void setRecordTime(String recordTime) {
            this.recordTime = recordTime;
        }
    }

    public static class RecordAddedEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger blockId;

        public BigInteger productId;

        public BigInteger userId;
    }
}